<?xml version='1.0' encoding='ISO-8859-1' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"   
      xmlns:jb="http://java.sun.com/jsf/composite/componentes"
      xmlns:p="http://primefaces.org/ui">

    <SCRIPT language="JavaScript" type="text/javascript">
                   
        function handleRequest(xhr, status, args) {                     
            if(args.validationFailed || !args.CallbackParam) {  
     
            } else {                              
                carDialogDetalle.hide();  
                jQuery('#btnGuardarDetalle').fadeOut();  
            }  
        }  
    </SCRIPT>
    <h:form onsubmit="return checkSubmit();"  id="frmDetalle">
        <h:panelGrid id="pgFormDtoDeta"   frame="box">
            <h:panelGrid  columns="6" cellpadding="4">
                <h:outputLabel for="itEmpresa" styleClass="label" value="#{i18n['siscontrol.empresa']}"/>
                <h:outputText id="itEmpresa" value="#{sistemaControlCompMBean.detaDto.empresaDto.descripcion}"  styleClass="general"/>

                <h:outputLabel  styleClass="label" value="#{i18n['siscontrol.deta.encargado']}"/>
                <p:selectOneMenu value="#{sistemaControlCompMBean.detaDto.isRol}" required="true"                                  
                                 style="#{applicationMBean.estiloObligatorio}" disabled="#{sessionMBean.accionDetalle == applicationMBean.ver}">
                    <f:selectItems value="#{sistemaControlCompMBean.siTipoDeta}"/>
                    <p:ajax update=":frmDetalle"/>
                </p:selectOneMenu>  

                <p:autoComplete id="itUsuario" value="#{sistemaControlCompMBean.detaDto.usuarioDto}" completeMethod="#{usuarioMBean.autoCompletarUsuario}" rendered="#{sistemaControlCompMBean.detaDto.isRol == 'U'}"
                                label="#{i18n['siscontrol.deta.encargado1']}" required="true" readonly="#{sessionMBean.accionDetalle == applicationMBean.ver}" maxResults="10" minQueryLength="#{applicationMBean.minQueryLengthAutoComplete}" queryDelay="1" 
                                converter="usuarioConvert" var="sn" itemLabel="#{sn.descripcion}" itemValue="#{sn}" size="50" forceSelection="true"> 
                    <p:column style="#{applicationMBean.estiloObligatorio}" > 
                        #{sn.rolDto.descripcion} || #{sn.login}
                    </p:column> 
                </p:autoComplete>
                <p:watermark id="phUsuario" for="itUsuario" value="#{i18n['siscontrol.deta.placeholder.usuario']}" rendered="#{sistemaControlCompMBean.detaDto.isRol  == 'U'}"/>  

                <p:autoComplete id="itRol" value="#{sistemaControlCompMBean.detaDto.rolDto}" completeMethod="#{rolMBean.autoCompletarRol}" rendered="#{sistemaControlCompMBean.detaDto.isRol == 'R'}"
                                label="#{i18n['siscontrol.deta.encargado1']}" required="true" readonly="#{sessionMBean.accionDetalle == applicationMBean.ver}" maxResults="10" minQueryLength="#{applicationMBean.minQueryLengthAutoComplete}" queryDelay="1" 
                                converter="rolConvert" var="sn" itemLabel="#{sn.descripcion}" itemValue="#{sn}" size="50" forceSelection="true"> 
                    <p:column style="#{applicationMBean.estiloObligatorio}" > 
                        #{sn.descripcion}
                    </p:column> 
                </p:autoComplete>
                <p:watermark id="phRol" for="itRol" value="#{i18n['siscontrol.deta.placeholder.rol']}" rendered="#{sistemaControlCompMBean.detaDto.isRol == 'R'}"/>  

                <h:outputLabel for="itObligatorio" styleClass="label" value="#{i18n['siscontrol.deta.oligatorio']}"/>
                <p:selectBooleanCheckbox id="itObligatorio" value="#{sistemaControlCompMBean.detaDto.obligatorio}"  style="#{applicationMBean.estilo}"  disabled="#{sessionMBean.accionDetalle == applicationMBean.ver || sistemaControlCompMBean.dto.todos}"/>

                <h:outputLabel styleClass="label" value="#{i18n['general.label.activo']}"/>                    
                <p:selectBooleanCheckbox value="#{sistemaControlCompMBean.detaDto.estado}"  style="#{applicationMBean.estilo}"  disabled="#{sessionMBean.accionDetalle == applicationMBean.ver}"/>
            </h:panelGrid>  

            <p:panel id="pnlAcciones">
                <h:panelGrid columns="10">
                    <p:commandButton id="btnGuardarDetalle" update=":msjDialogDeta,:frmPrincipal:tblDetalles" 
                                     title="#{i18n['general.button.guardar.tip']}"
                                     style="#{applicationMBean.estilosBtnGuardar}"
                                     ajax="true"                                  
                                     icon="ui-icon ui-icon-disk" rendered="#{sessionMBean.accionDetalle != applicationMBean.ver}"
                                     value="#{i18n['general.button.guardar']}" 
                                     action="#{sistemaControlCompMBean.guardarDetalle}"
                                     oncomplete="handleRequest(xhr, status, args);">                                    
                    </p:commandButton>
                </h:panelGrid>
            </p:panel>
        </h:panelGrid>  
    </h:form>
</html>